imx: mx6: lcdif: gate clock before changing mux
authorPeng Fan <[email protected]>
Sun, 11 Dec 2016 11:24:26 +0000 (19:24 +0800)
committerStefano Babic <[email protected]>
Fri, 16 Dec 2016 10:38:24 +0000 (11:38 +0100)
The mux for the lcd clock is not glitchless,
so need to first gate the clock before changing the mux.

Signed-off-by: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>
arch/arm/cpu/armv7/mx6/clock.c

index 88f68f1137b6e91ee7b729a5266b12cee539863f..20922606e0884e385cdf3b5371e5bd9d984d8fff 100644 (file)
@@ -771,6 +771,16 @@ int enable_lcdif_clock(u32 base_addr)
                return 0;
        }
 
+       /* Gate LCDIF clock first */
+       reg = readl(&imx_ccm->CCGR3);
+       reg &= ~lcdif_ccgr3_mask;
+       writel(reg, &imx_ccm->CCGR3);
+
+       reg = readl(&imx_ccm->CCGR2);
+       reg &= ~MXC_CCM_CCGR2_LCD_MASK;
+       writel(reg, &imx_ccm->CCGR2);
+
+       /* Select pre-mux */
        reg = readl(&imx_ccm->cscdr2);
        reg &= ~lcdif_clk_sel_mask;
        writel(reg, &imx_ccm->cscdr2);